package com.castle.fortress.admin.member.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.castle.fortress.admin.member.entity.MemberAuthorityEntity;
import com.castle.fortress.admin.member.dto.MemberAuthorityDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.castle.fortress.admin.system.entity.SysUser;

import java.util.Map;
import java.util.List;

/**
 * 会员可见权限表 服务类
 *
 * @author castle
 * @since 2023-02-14
 */
public interface MemberAuthorityService extends IService<MemberAuthorityEntity> {

    /**
     * 分页展示会员可见权限表列表
     * @param page
     * @param memberAuthorityDto
     * @return
     */
    IPage<MemberAuthorityDto> pageMemberAuthority(Page<MemberAuthorityDto> page, MemberAuthorityDto memberAuthorityDto);


    /**
     * 展示会员可见权限表列表
     * @param memberAuthorityDto
     * @return
     */
    List<MemberAuthorityDto> listMemberAuthority(MemberAuthorityDto memberAuthorityDto);

    /**
     * 获取运营端用户的可授权范围
     * @param authorityType 权限类型
     * @param imposeId  需要限制的对象id
     * @param sysUser 当前登录用户
     * @return
     */
    Map<String, Object> scope(Integer authorityType, Long imposeId, SysUser sysUser);

    /**
     * 依据当前登录用户
     * 依据授权类别和限定id获取授权信息
     * @param authorityType
     * @param imposeId
     * @return
     */
    MemberAuthorityDto getByImposeId(Integer authorityType,Long imposeId, SysUser sysUser);
    /**
     * 获取可见权限的查询条件map
     * @param code
     * @param memberId
     * @return
     */
    Map<String, Object> getAuthorityQueryMap(Integer code, Long memberId);

    /**
     * 校验当前用户是否有权限
     * @param authorityType
     * @param imposeId
     * @param memberId
     * @return true 可以访问 false 不可访问
     */
    Boolean checkUserAuthByPoseId(Integer authorityType,Long imposeId,Long memberId);
}
